<?php
//include('Test.php'); //这个是你下面实例化的类
include_once './Test.php';
$input = file_get_contents("php://input");
$post=json_decode($input,true);
$productKey = $post['productKey'];
$deviceName = $post['device_id'];

//print_r($deviceName);
//print_r($input);die;
	// //启动请求命令
	// $post_data1['topic'] = "/". $productKey ."/" . $deviceName ."/cmd";
	// $post_data1['value']      =  "G7q1/+D+03bvS+DVRn0mEw==";
	// $post_data1['cmd']        =  "06000C010060";
	// $post_data1['ts']         =  time();
	// $input = file_get_contents("php://input");
	// foreach ($$input as $key => $value) {
	// 		print_r($value);
	// 	}
		
	$SmsDemo = new Tests();
	foreach ($deviceName as $key => $value) {
		$data_qidong[] = $SmsDemo->registDeviceTest($productKey,$value);
		}
    print_r(json_encode($data_qidong));

	 // return $data_qidong;
	
	
	// if($data_qidong['Success'] == 1){
	// 	header('refresh:5;url=./biaozhunxi.php');
	// 	print('洗衣机正在重置，请稍等...');
	// }
//print_r($data);die;

//zJu5dp2h2vU/865933031094853/cmd
/* $request = new Iot\CreateProductRequest();
$request->setProductKey("zJu5dp2h2vU");
$request->setMessageContent("3Jvi8MI1qhEsquX2+MQmuw=="); //hello world Base64 String.
$request->setTopicFullName("/zJu5dp2h2vU/865933031094853/cmd"); //消息发送到的Topic全名.
$response = $client->getAcsResponse($request);
print_r($response); */


//$response = $SmsDemo::pubTests('zJu5dp2h2vU',865933031094853);
//$response = $SmsDemo->pubTests('zJu5dp2h2vU',865933031094853);
